<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

<%
	HttpSession s = request.getSession();
%>
<body class="full" id="content">
<div id="alert"></div>
<div id="addWageList"></div>
<div class="row">
	<div class="col-lg-12 col-md-12 col-sm-12 ">
		<form class="form-inline" role="form" id="selectDepVal">
			<div class="row">
				<div class="form-group inputselect col-lg-4">
					<sec:authorize access="hasRole('ROLE_ADMIN')">
						<button type="button" class="btn btn-info btn-sm " >
							<a href="${pageContext.request.contextPath}/exportExcel">导出</a>
							<span class="glyphicon glyphicon-user"></span>
						</button>
					</sec:authorize>
				</div>
			</div>
		</form>
		<form class="form-inline" role="form"></form>

		<div class="table-responsive " style="margin-left: 3%;">

			<table class="table table-hover tablefont">
				<tbody id="tableList">
				</tbody>
			</table>
			<div style="bottom: 10%">
				<div id="paging" style="text-align: center; margin-left: 25%;">
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">

	//增加
	var authority = "${authority}";
	var usrname = "${username}";
	//增加
	var pageSize = 8;
	var dataUrl = "${pageContext.request.contextPath}/wagePerson";
	selectList= function(){
		initPage("0",pageSize,dataUrl);
	};
	initPage("0", pageSize, dataUrl);
	function initPage(num, ps, url) {
		//alert(num);
		$.ajax({
			url : url,
			type : "GET",
			data : "currentPage=" + num + "&pageSize=" + ps ,
			contentType : "application/json;charset=utf-8",
			success : function(msg) {
				//alert(data.username);
				initTable(msg);
				// if("[ROLE_USER]"==authority){
				// 	var mi=1;
				// 	while($('#tableList tr:eq('+ mi + ') td:eq(1)').text()!=""){
				// 		if($('#tableList tr:eq('+ mi + ') td:eq(1)').text()!=usrname){
				// 			$('#tableList tr:eq('+ mi + ')').text("");
				// 		}
				// 		mi++;
				// 	}
				// 	$("#paging").attr("style","display:none;");
				// }
				var i=1;
				var sqlData;
				var dateR;
				//表格用的日期格式
				var newDate = new Date();
			},
			error : function(e) {
				console.log(e)
				alert("失败");
			}
		});
	}
	//初始化表格
	function initTable(data) {
		var obj = data.extend.data.list;
		var page = data.extend.data;
		page.pageNumber=page.pageNum;
		//table
		myTable = $.lTable(
				'#tableList',
				{
					data : obj,
					title : ["id","account","username","basewage","paywage","at","booleanpay"] ,
					name : [ "id","员工编号", "员工姓名","实际工资","缴后工资","税后工资","是否发放"],
					tid : "id",
					checkBox : "id"
				});
		$.lPaging('#paging',
				{
					pageNumber : page.pageNumber
					,
					totalPage : page.pages
					,
					countSize : 8
					,
					count : page.total
					,
					inputSearch : false
					,
					onPageChange : function(num) {
						initPage(num, pageSize, dataUrl);
					}
				});
	}
	//编辑
	function updF(id) {
		$.ajax({
			type : "POST",
			url : "${pageContext.request.contextPath}/payM",
			data : id,
			async : true,
			// dataType:"json",
			contentType : "application/json;charset=utf-8",
			success : function(msg) {
				alert(msg.message);
			},
			error : function(msg) {
				alert("bb");
			}
		});
		selectList();
	}
</script>
</body>





